package com.job.meeting.pojo;

import com.google.gson.Gson;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Autowired;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class wechatMessageMeetingUpdate {
    private unit state;
    private unit date;
    private unit meetingRoom;
    private unit reply;

    wechatMessageMeetingUpdate(String json) {
        wechatMessageMeetingUpdate update = new Gson().fromJson(json, wechatMessageMeetingUpdate.class);
        this.state = update.getState();
        this.date = update.getDate();
        this.meetingRoom = update.getMeetingRoom();
        this.reply = update.getReply();
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }

    public void setState(int state) {
        this.state = new unit("", " #8B008B");
        switch (state) {
            case 0:
                this.state.setValue("未通过");
                break;
            case 1:
                this.state.setValue("审批中");
                break;
            case 2:
                this.state.setValue("已通过");
                break;
            default:
                this.state.setValue("请联系管理员");
                break;
        }
    }
}
